//
//  ReadTopBar.swift
//  Spookiness
//
//  Created by 腾億 on 2017/12/21.
//  Copyright © 2017年 tml. All rights reserved.
//

import UIKit

class ReadTopBar: UIView {

    lazy var backButton: UIButton = {
        let btn = UIButton(type: .custom)
        btn.setImage(#imageLiteral(resourceName: "nav_back_black"), for: .normal)
        return btn
    }()
    
    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.textAlignment = .center
        label.font = UIFont.systemFont(ofSize: 18)
        label.textColor = UIColor.black
        return label
    }()
    
    fileprivate func setUpSnap() {
        self.backButton.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(10)
            make.bottom.equalToSuperview().offset(-2)
            make.width.height.equalTo(40)
        }
        
        self.titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.backButton.snp.right).offset(10)
            make.right.equalToSuperview().offset(-60)
            make.height.equalTo(35)
            make.bottom.equalToSuperview().offset(-2)
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubview(self.backButton)
        addSubview(self.titleLabel)
        setUpSnap()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
